package com.mn.sso.starter.config;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * @author liutao
 * @date 2022年01月14日 18:51
 */
@Data
@ConfigurationProperties("sso")
public class SsoProperties {

    /** 应用 */
    private App app;
    /**
     * 服务
     */
    private Server server;
    private Session session;
    private int timeout = 7200;
    /**
     * 排除URL
     */
    private String excludeUrls;
    /**
     * 注册名称
     */
    private String registerName = "ssoContainer";

    private Filter filter;

    static class App {
        /** 应用id */
        private String id;
        /** 密钥 */
        private String secret;

        public String getId() {
            return id;
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getSecret() {
            return secret;
        }

        public void setSecret(String secret) {
            this.secret = secret;
        }
    }

    static class Server {
        /**
         * 服务地址
         */
        private String url;

        public String getUrl() {
            return url;
        }

        public void setUrl(String url) {
            this.url = url;
        }
    }

    @Data
    static class Session {
        private Redis redis;
        private Local local;

    }

    @Data
    static class Redis{
        private boolean enable = Boolean.FALSE;

    }
    @Data
    static class Local{
        private boolean enable = Boolean.FALSE;
    }
    @Data
    static class Filter{
        private String urls;
        private int order = 1;
    }

}
